package com.saturn.action.sldb.discussion;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.saturn.app.utils.BeanUtils;
import com.saturn.app.web.IAction;
import com.saturn.app.web.IView;
import com.saturn.app.web.view.JspErrorView;
import com.saturn.app.web.view.JspView;
import com.saturn.sldb.Discussion;

public class UpdateDiscussionAction implements IAction{
	@Override
	public IView execute(HttpServletRequest request,
			HttpServletResponse response) {
		Discussion vo = BeanUtils.getBean(request, Discussion.class);

		String inputType = request.getParameter("inputType");
		if("自动".equals(inputType)){
			if (Discussion.edit(vo) == 1) {
				return new JspView("/app/sldb/discussion/apply/autoShow.jsp");
			} else {
				return new JspErrorView("更新信息失败");
			}
		}else{
			if (Discussion.edit(vo) == 1) {
				return new JspView("/app/sldb/discussion/apply/show.jsp");
			} else {
				return new JspErrorView("更新信息失败");
			}
		}
	}
	@Override
	public String requestMapping() {
		return "/app/sldb/discussion/apply/updateDiscussion.action";
	}
}
